package com.qezhhnjy.demo.convert;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.StopWatch;
import org.dozer.DozerBeanMapper;

/**
 * @author zhaoyangfu
 * @date 2021/7/2-10:46
 */
public class ConvertApplication {

    public static void main(String[] args) {
        DozerBeanMapper mapper = new DozerBeanMapper();

        StopWatch watch = new StopWatch();
        watch.start("dozer");
        App name = new App("name", "app");
        int max = 10000000;
        for (int i = 0; i < max; i++) {
            AppDTO dto = mapper.map(name, AppDTO.class);
        }
        watch.stop();
        watch.start("hutool");
        App hutool = new App("hutool", "app");
        for (int i = 0; i < max; i++) {
            AppDTO dto = BeanUtil.toBean(hutool, AppDTO.class);
        }
        watch.stop();
        System.out.println(watch.prettyPrint());
    }
}

